/*    */ package com.newcrm.webapi.sub;
/*    */ 
/*    */ import com.newcrm.bean.User;
/*    */ import com.newcrm.db.ImportantDateManager;
/*    */ import com.newcrm.exception.NotFoundException;
/*    */ import com.newcrm.util.Util;
/*    */ import com.newcrm.webapi.AbstractAction;
/*    */ import com.newcrm.webapi.AbstractHttpServlet;
/*    */ import java.io.IOException;
/*    */ import java.io.PrintWriter;
/*    */ import java.util.Date;
/*    */ import java.util.List;
/*    */ import javax.servlet.ServletException;
/*    */ import javax.servlet.http.HttpServletRequest;
/*    */ import javax.servlet.http.HttpServletResponse;
/*    */ import net.sf.json.JSONObject;
/*    */ import org.apache.log4j.Logger;
/*    */ 
/*    */ public class ListAllImportantDates extends AbstractAction
/*    */ {
/* 27 */   private static Logger logger = Logger.getLogger(ListAllImportantDates.class
/* 28 */     .getName());
/*    */ 
/*    */   public ListAllImportantDates(AbstractHttpServlet servlet)
/*    */   {
/* 31 */     super(servlet);
/*    */   }
/*    */ 
/*    */   public void parse(HttpServletRequest request, HttpServletResponse response)
/*    */     throws IOException, ServletException, NotFoundException
/*    */   {
/* 38 */     User user = super.getLoginUser(request);
/* 39 */     String userId = user.userId;
/*    */ 
/* 41 */     ImportantDateManager manager = new ImportantDateManager();
/*    */ 
/* 43 */     Date date = Util.str2Date(request.getParameter("date"));
/* 44 */     int offset = Util.getURLIntParameter(request.getParameter("offset"));
/*    */ 
/* 46 */     response.setContentType("text/html;charset=utf-8");
/* 47 */     PrintWriter out = response.getWriter();
/* 48 */     JSONObject jsonObject = new JSONObject();
/*    */     try {
/* 50 */       List result = manager.getList(date, userId, 
/* 51 */         offset, 10);
/* 52 */       jsonObject.put("error", "0");
/* 53 */       jsonObject.put("importantDates", result);
/*    */     } catch (Exception e) {
/* 55 */       logger.warn("get importantDates failed", e);
/* 56 */       jsonObject.put("error", "1");
/*    */     }
/* 58 */     out.println(jsonObject);
/* 59 */     out.flush();
/* 60 */     out.close();
/*    */   }
/*    */ }

/* Location:           C:\E\referenceProject\CRM参考\qikebao\WEB-INF\lib\qikebao.jar
 * Qualified Name:     com.newcrm.webapi.sub.ListAllImportantDates
 * JD-Core Version:    0.6.1
 */